home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / kcl / akcl / akcl1615.lha / doc / volatile < prev   
Lisp/Scheme  |  1987-11-24  |  1KB  |  49 lines

  1. (trace t2defun)
  2. (defun foo (x) (catch 'joe (loop (goo ))) x)
  3. Changes necessary because any variables which want to live past a setjmp
  4. must be declared volatile.  This includes things like "base".  Otherwise
  5. the compiler is free to trash these, according to ANSI C.
  6.  
  7.  
  8. (devar *volatile*)
  9. add info-volatile slot to info
  10.  
  11. any c1 form that can lay down a setjmp does (setq *volatile* t).
  12. any c1 form that does bindings, binds *volatile* = nil
  13. and then on exit sets its info to have info-volatile.
  14. on pass 2 and 3, the info-volatile is examined, and if t then
  15. VOL is added to the appropriate declares.
  16.  
  17.  
  18.  
  19. (defun t1defun  &aux *volatile*
  20.   .....
  21. .. 
  22.  (setf (info-volatile info) *volatile*)
  23.  )
  24.  
  25. (defun c1catch ..(setq *volatile* t))
  26.  
  27.  
  28.  
  29. Then t3defun, c2let, c2let*,.. and other forms which lay down bindings,
  30. must use the info-volatile information, when writing out their bindings,
  31. adding a VOL before rep-type.
  32.  
  33. h/object.h 
  34. h/cmpinclude.h
  35.  
  36. will have a 
  37. #ifndef VOL
  38. #define VOL
  39. #endif
  40.  
  41. then for gcc you would use
  42. CC = gcc -DVOL=volatile
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.